#bin/bash
#cd ../yeez-privarcy-computing/
rm tags.txt
touch tags.txt
#echo "analyzer(" >> tags.txt
cd ../yeez/
#git describe --abbrev=0 --tags
git describe --abbrev=0 --tags > ../fidelius-pkg/tags.txt
cat ../fidelius-pkg/tags.txt | while read line
do
  git checkout $line
done
cd ../fidelius-pkg/

#echo ") bionic;urgency=medium" >> tags.txt
#echo $(pwd)
#cd ../analyzer-2.0.0/
cat tags.txt | while read line
do
  sed -i "1a analyzer ($line) bionic; urgency=medium" analyzer-1.0.0/debian/changelog
  sed -i "1a keymgr ($line) bionic; urgency=medium" keymgr-1.0.0/debian/changelog
  sed -i "1a stboxcommonu ($line) bionic; urgency=medium" stboxcommonu-1.0.0/debian/changelog
  sed -i "1a ypccommonu ($line) bionic; urgency=medium" ypccommonu-1.0.0/debian/changelog
  sed -i "1a yterminus ($line) bionic; urgency=medium" yterminus-1.0.0/debian/changelog
  sed -i "1a datahub ($line) bionic; urgency=medium" datahub-1.0.0/debian/changelog
  sed -i "1a fflib ($line) bionic; urgency=medium" fflib-1.0.0/debian/changelog
#  sed -i "1a secp256k1y ($line) bionic; urgency=medium" secp256k1y-1.0.0/debian/changelog
  sed -i "1a ydump ($line) bionic; urgency=medium" ydump-1.0.0/debian/changelog
  sed -i "1a ypccore ($line) bionic; urgency=medium" ypccore-1.0.0/debian/changelog

  #sed -i '1a analyzer ($line) bionic; urgency=medium' debian/changelog
done
sed -i '1d' analyzer-1.0.0/debian/changelog
sed -i '1d' keymgr-1.0.0/debian/changelog
sed -i '1d' stboxcommonu-1.0.0/debian/changelog
sed -i '1d' ypccommonu-1.0.0/debian/changelog
sed -i '1d' yterminus-1.0.0/debian/changelog
sed -i '1d' datahub-1.0.0/debian/changelog
sed -i '1d' fflib-1.0.0/debian/changelog
#sed -i '1d' secp256k1y-1.0.0/debian/changelog
sed -i '1d' ydump-1.0.0/debian/changelog
sed -i '1d' ypccore-1.0.0/debian/changelog


#echo tags
